package com.loanapp.server.market.api.bbs.hystrix;

import com.github.pagehelper.PageInfo;
import com.loanapp.server.market.api.bbs.api.PostApi;
import com.loanapp.server.market.api.bbs.entity.Post;
import com.loanapp.server.market.api.bbs.query.PostQuery;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class PostApiFallbackFactory implements FallbackFactory<PostApi> {

    public PostApi create(final Throwable throwable) {
        return new PostApi() {
            public PageInfo<Map<String, Object>> getPostListPage(PostQuery query) throws Exception {
                throwable.printStackTrace();
                return null;
            }

            public Map<String, Object> getPostWithCommentById(Long id) throws Exception {
                return null;
            }

            public Long Insert(Post post) throws Exception {
                return null;
            }

            public boolean CanPost(Long uid) throws Exception {
                return false;
            }
        };
    }
}